<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<title>OpenCV: Features2D + Homography to find a known object</title>
<link href="../../opencv.ico" rel="shortcut icon" type="image/x-icon" />
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../tutorial-utils.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
//<![CDATA[
MathJax.Hub.Config(
{
  TeX: {
      Macros: {
          matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
          fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
          forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
          forkfour: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ #7 & \\mbox{#8}\\\\ \\end{array} \\right.", 8],
          vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
          vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
          cameramatrix: ["#1 = \\begin{bmatrix} f_x & 0 & c_x\\\\ 0 & f_y & c_y\\\\ 0 & 0 & 1 \\end{bmatrix}", 1],
          distcoeffs: ["(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \\tau_x, \\tau_y]]]]) \\text{ of 4, 5, 8, 12 or 14 elements}"],
          distcoeffsfisheye: ["(k_1, k_2, k_3, k_4)"],
          hdotsfor: ["\\dots", 1],
          mathbbm: ["\\mathbb{#1}", 1],
          bordermatrix: ["\\matrix{#1}", 1]
      }
  }
}
);
//]]>
</script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<link href="../../stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<!--#include virtual="/google-search.html"-->
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../opencv-logo-small.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">OpenCV
   &#160;<span id="projectnumber">4.5.2</span>
   </div>
   <div id="projectbrief">Open Source Computer Vision</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('../../',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../d9/df8/tutorial_root.html">OpenCV Tutorials</a></li><li class="navelem"><a class="el" href="../../d9/d97/tutorial_table_of_content_features2d.html">2D Features framework (feature2d module)</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Features2D + Homography to find a known object </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><b>Prev Tutorial:</b> <a class="el" href="../../d5/d6f/tutorial_feature_flann_matcher.html">Feature Matching with FLANN</a></p>
<p><b>Next Tutorial:</b> <a class="el" href="../../dd/dd4/tutorial_detection_of_planar_objects.html">Detection of planar objects</a></p>
<table class="doxtable">
<tr>
<th align="right"></th><th align="left"></th></tr>
<tr>
<td align="right">Original author </td><td align="left">Ana Huamán </td></tr>
<tr>
<td align="right">Compatibility </td><td align="left">OpenCV &gt;= 3.0 </td></tr>
</table>
<h2>Goal </h2>
<p>In this tutorial you will learn how to:</p>
<ul>
<li>Use the function <a class="el" href="../../d9/d0c/group__calib3d.html#ga4abc2ece9fab9398f2e560d53c8c9780">cv::findHomography</a> to find the transform between matched keypoints.</li>
<li>Use the function <a class="el" href="../../d2/de8/group__core__array.html#gad327659ac03e5fd6894b90025e6900a7">cv::perspectiveTransform</a> to map the points.</li>
</ul>
<dl class="section warning"><dt>Warning</dt><dd>You need the <a href="https://github.com/opencv/opencv_contrib">OpenCV contrib modules</a> to be able to use the SURF features (alternatives are ORB, KAZE, ... features).</dd></dl>
<h2>Theory </h2>
<h2>Code </h2>
 <div class='newInnerHTML' title='cpp' style='display: none;'>C++</div><div class='toggleable_div label_cpp' style='display: none;'><p> This tutorial code's is shown lines below. You can also download it from <a href="https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.cpp">here</a> </p><div class="fragment"><div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="../../d0/d9c/core_2include_2opencv2_2core_8hpp.html">opencv2/core.hpp</a>&quot;</span></div><div class="line"><span class="preprocessor">#ifdef HAVE_OPENCV_XFEATURES2D</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="../../d2/d28/calib3d_8hpp.html">opencv2/calib3d.hpp</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="../../d4/dd5/highgui_8hpp.html">opencv2/highgui.hpp</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="../../d1/d4f/imgproc_2include_2opencv2_2imgproc_8hpp.html">opencv2/imgproc.hpp</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="../../d5/d0d/features2d_8hpp.html">opencv2/features2d.hpp</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="../../dc/daa/xfeatures2d_8hpp.html">opencv2/xfeatures2d.hpp</a>&quot;</span></div><div class="line"></div><div class="line"><span class="keyword">using namespace </span><a class="code" href="../../d2/d75/namespacecv.html">cv</a>;</div><div class="line"><span class="keyword">using namespace </span><a class="code" href="../../d3/df6/namespacecv_1_1xfeatures2d.html">cv::xfeatures2d</a>;</div><div class="line"><span class="keyword">using</span> std::cout;</div><div class="line"><span class="keyword">using</span> std::endl;</div><div class="line"></div><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span>* keys =</div><div class="line">        <span class="stringliteral">&quot;{ help h |                  | Print help message. }&quot;</span></div><div class="line">        <span class="stringliteral">&quot;{ input1 | box.png          | Path to input image 1. }&quot;</span></div><div class="line">        <span class="stringliteral">&quot;{ input2 | box_in_scene.png | Path to input image 2. }&quot;</span>;</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main( <span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>* argv[] )</div><div class="line">{</div><div class="line">    <a class="code" href="../../d0/d2e/classcv_1_1CommandLineParser.html">CommandLineParser</a> parser( argc, argv, keys );</div><div class="line">    <a class="code" href="../../d3/d63/classcv_1_1Mat.html">Mat</a> img_object = <a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>( <a class="code" href="../../d6/dba/group__core__utils__samples.html#ga3a33b00033b46c698ff6340d95569c13">samples::findFile</a>( parser.get&lt;<a class="code" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a>&gt;(<span class="stringliteral">&quot;input1&quot;</span>) ), <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a> );</div><div class="line">    <a class="code" href="../../d3/d63/classcv_1_1Mat.html">Mat</a> img_scene = <a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">imread</a>( <a class="code" href="../../d6/dba/group__core__utils__samples.html#ga3a33b00033b46c698ff6340d95569c13">samples::findFile</a>( parser.get&lt;<a class="code" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a>&gt;(<span class="stringliteral">&quot;input2&quot;</span>) ), <a class="code" href="../../d8/d6a/group__imgcodecs__flags.html#gga61d9b0126a3e57d9277ac48327799c80ae29981cfc153d3b0cef5c0daeedd2125">IMREAD_GRAYSCALE</a> );</div><div class="line">    <span class="keywordflow">if</span> ( img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#abbec3525a852e77998aba034813fded4">empty</a>() || img_scene.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#abbec3525a852e77998aba034813fded4">empty</a>() )</div><div class="line">    {</div><div class="line">        cout &lt;&lt; <span class="stringliteral">&quot;Could not open or find the image!\n&quot;</span> &lt;&lt; endl;</div><div class="line">        parser.printMessage();</div><div class="line">        <span class="keywordflow">return</span> -1;</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">//-- Step 1: Detect the keypoints using SURF Detector, compute the descriptors</span></div><div class="line">    <span class="keywordtype">int</span> minHessian = 400;</div><div class="line">    <a class="code" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr&lt;SURF&gt;</a> detector = <a class="code" href="../../d5/df7/classcv_1_1xfeatures2d_1_1SURF.html#a436553ca44d9a2238761ddbee5b395e5">SURF::create</a>( minHessian );</div><div class="line">    std::vector&lt;KeyPoint&gt; keypoints_object, keypoints_scene;</div><div class="line">    <a class="code" href="../../d3/d63/classcv_1_1Mat.html">Mat</a> descriptors_object, descriptors_scene;</div><div class="line">    detector-&gt;detectAndCompute( img_object, <a class="code" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>(), keypoints_object, descriptors_object );</div><div class="line">    detector-&gt;detectAndCompute( img_scene, <a class="code" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>(), keypoints_scene, descriptors_scene );</div><div class="line"></div><div class="line">    <span class="comment">//-- Step 2: Matching descriptor vectors with a FLANN based matcher</span></div><div class="line">    <span class="comment">// Since SURF is a floating-point descriptor NORM_L2 is used</span></div><div class="line">    <a class="code" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr&lt;DescriptorMatcher&gt;</a> matcher = <a class="code" href="../../db/d39/classcv_1_1DescriptorMatcher.html#ab5dc5036569ecc8d47565007fa518257">DescriptorMatcher::create</a>(<a class="code" href="../../db/d39/classcv_1_1DescriptorMatcher.html#af8b6f4acb8f1a9ea6b73bfcb86b80c3baf73d671c6860c24f44b2880a77fadcdc">DescriptorMatcher::FLANNBASED</a>);</div><div class="line">    std::vector&lt; std::vector&lt;DMatch&gt; &gt; knn_matches;</div><div class="line">    matcher-&gt;knnMatch( descriptors_object, descriptors_scene, knn_matches, 2 );</div><div class="line"></div><div class="line">    <span class="comment">//-- Filter matches using the Lowe&#39;s ratio test</span></div><div class="line">    <span class="keyword">const</span> <span class="keywordtype">float</span> ratio_thresh = 0.75f;</div><div class="line">    std::vector&lt;DMatch&gt; good_matches;</div><div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; knn_matches.size(); i++)</div><div class="line">    {</div><div class="line">        <span class="keywordflow">if</span> (knn_matches[i][0].distance &lt; ratio_thresh * knn_matches[i][1].distance)</div><div class="line">        {</div><div class="line">            good_matches.push_back(knn_matches[i][0]);</div><div class="line">        }</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">//-- Draw matches</span></div><div class="line">    <a class="code" href="../../d3/d63/classcv_1_1Mat.html">Mat</a> img_matches;</div><div class="line">    <a class="code" href="../../d4/d5d/group__features2d__draw.html#gad8f463ccaf0dc6f61083abd8717c261a">drawMatches</a>( img_object, keypoints_object, img_scene, keypoints_scene, good_matches, img_matches, <a class="code" href="../../d1/da0/classcv_1_1Scalar__.html#ac1509a4b8454fe7fe29db069e13a2e6f">Scalar::all</a>(-1),</div><div class="line">                 <a class="code" href="../../d1/da0/classcv_1_1Scalar__.html#ac1509a4b8454fe7fe29db069e13a2e6f">Scalar::all</a>(-1), std::vector&lt;char&gt;(), <a class="code" href="../../d4/d5d/group__features2d__draw.html#gga2c2ede79cd5141534ae70a3fd9f324c8a811ff9a659123ff7317ccd1269e59259">DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS</a> );</div><div class="line"></div><div class="line">    <span class="comment">//-- Localize the object</span></div><div class="line">    std::vector&lt;Point2f&gt; obj;</div><div class="line">    std::vector&lt;Point2f&gt; scene;</div><div class="line"></div><div class="line">    <span class="keywordflow">for</span>( <span class="keywordtype">size_t</span> i = 0; i &lt; good_matches.size(); i++ )</div><div class="line">    {</div><div class="line">        <span class="comment">//-- Get the keypoints from the good matches</span></div><div class="line">        obj.push_back( keypoints_object[ good_matches[i].queryIdx ].pt );</div><div class="line">        scene.push_back( keypoints_scene[ good_matches[i].trainIdx ].pt );</div><div class="line">    }</div><div class="line"></div><div class="line">    <a class="code" href="../../d3/d63/classcv_1_1Mat.html">Mat</a> H = <a class="code" href="../../d9/d0c/group__calib3d.html#ga4abc2ece9fab9398f2e560d53c8c9780">findHomography</a>( obj, scene, <a class="code" href="../../d9/d0c/group__calib3d.html#gga58a3bc75c7337534ea9c1697b928cae0a724159df258a5d7e29410a6a2f4e6c87">RANSAC</a> );</div><div class="line"></div><div class="line">    <span class="comment">//-- Get the corners from the image_1 ( the object to be &quot;detected&quot; )</span></div><div class="line">    std::vector&lt;Point2f&gt; obj_corners(4);</div><div class="line">    obj_corners[0] = <a class="code" href="../../dc/d84/group__core__basic.html#ga7d080aa40de011e4410bca63385ffe2a">Point2f</a>(0, 0);</div><div class="line">    obj_corners[1] = <a class="code" href="../../dc/d84/group__core__basic.html#ga7d080aa40de011e4410bca63385ffe2a">Point2f</a>( (<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#aa3e5a47585c9ef6a0842556739155e3e">cols</a>, 0 );</div><div class="line">    obj_corners[2] = <a class="code" href="../../dc/d84/group__core__basic.html#ga7d080aa40de011e4410bca63385ffe2a">Point2f</a>( (<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#aa3e5a47585c9ef6a0842556739155e3e">cols</a>, (<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#abed816466c45234254d25bc59c31245e">rows</a> );</div><div class="line">    obj_corners[3] = <a class="code" href="../../dc/d84/group__core__basic.html#ga7d080aa40de011e4410bca63385ffe2a">Point2f</a>( 0, (<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#abed816466c45234254d25bc59c31245e">rows</a> );</div><div class="line">    std::vector&lt;Point2f&gt; scene_corners(4);</div><div class="line"></div><div class="line">    <a class="code" href="../../d2/de8/group__core__array.html#gad327659ac03e5fd6894b90025e6900a7">perspectiveTransform</a>( obj_corners, scene_corners, H);</div><div class="line"></div><div class="line">    <span class="comment">//-- Draw lines between the corners (the mapped object in the scene - image_2 )</span></div><div class="line">    <a class="code" href="../../d6/d6e/group__imgproc__draw.html#ga7078a9fae8c7e7d13d24dac2520ae4a2">line</a>( img_matches, scene_corners[0] + <a class="code" href="../../dc/d84/group__core__basic.html#ga7d080aa40de011e4410bca63385ffe2a">Point2f</a>((<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#aa3e5a47585c9ef6a0842556739155e3e">cols</a>, 0),</div><div class="line">          scene_corners[1] + <a class="code" href="../../db/d4e/classcv_1_1Point__.html">Point2f</a>((<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#aa3e5a47585c9ef6a0842556739155e3e">cols</a>, 0), <a class="code" href="../../d1/da0/classcv_1_1Scalar__.html">Scalar</a>(0, 255, 0), 4 );</div><div class="line">    <a class="code" href="../../d6/d6e/group__imgproc__draw.html#ga7078a9fae8c7e7d13d24dac2520ae4a2">line</a>( img_matches, scene_corners[1] + <a class="code" href="../../dc/d84/group__core__basic.html#ga7d080aa40de011e4410bca63385ffe2a">Point2f</a>((<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#aa3e5a47585c9ef6a0842556739155e3e">cols</a>, 0),</div><div class="line">          scene_corners[2] + <a class="code" href="../../db/d4e/classcv_1_1Point__.html">Point2f</a>((<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#aa3e5a47585c9ef6a0842556739155e3e">cols</a>, 0), <a class="code" href="../../d1/da0/classcv_1_1Scalar__.html">Scalar</a>( 0, 255, 0), 4 );</div><div class="line">    <a class="code" href="../../d6/d6e/group__imgproc__draw.html#ga7078a9fae8c7e7d13d24dac2520ae4a2">line</a>( img_matches, scene_corners[2] + <a class="code" href="../../dc/d84/group__core__basic.html#ga7d080aa40de011e4410bca63385ffe2a">Point2f</a>((<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#aa3e5a47585c9ef6a0842556739155e3e">cols</a>, 0),</div><div class="line">          scene_corners[3] + <a class="code" href="../../db/d4e/classcv_1_1Point__.html">Point2f</a>((<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#aa3e5a47585c9ef6a0842556739155e3e">cols</a>, 0), <a class="code" href="../../d1/da0/classcv_1_1Scalar__.html">Scalar</a>( 0, 255, 0), 4 );</div><div class="line">    <a class="code" href="../../d6/d6e/group__imgproc__draw.html#ga7078a9fae8c7e7d13d24dac2520ae4a2">line</a>( img_matches, scene_corners[3] + <a class="code" href="../../dc/d84/group__core__basic.html#ga7d080aa40de011e4410bca63385ffe2a">Point2f</a>((<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#aa3e5a47585c9ef6a0842556739155e3e">cols</a>, 0),</div><div class="line">          scene_corners[0] + <a class="code" href="../../db/d4e/classcv_1_1Point__.html">Point2f</a>((<span class="keywordtype">float</span>)img_object.<a class="code" href="../../d3/d63/classcv_1_1Mat.html#aa3e5a47585c9ef6a0842556739155e3e">cols</a>, 0), <a class="code" href="../../d1/da0/classcv_1_1Scalar__.html">Scalar</a>( 0, 255, 0), 4 );</div><div class="line"></div><div class="line">    <span class="comment">//-- Show detected matches</span></div><div class="line">    <a class="code" href="../../d7/dfc/group__highgui.html#ga453d42fe4cb60e5723281a89973ee563">imshow</a>(<span class="stringliteral">&quot;Good Matches &amp; Object detection&quot;</span>, img_matches );</div><div class="line"></div><div class="line">    <a class="code" href="../../d7/dfc/group__highgui.html#ga5628525ad33f52eab17feebcfba38bd7">waitKey</a>();</div><div class="line">    <span class="keywordflow">return</span> 0;</div><div class="line">}</div><div class="line"><span class="preprocessor">#else</span></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;This tutorial code needs the xfeatures2d contrib module to be run.&quot;</span> &lt;&lt; std::endl;</div><div class="line">    <span class="keywordflow">return</span> 0;</div><div class="line">}</div><div class="line"><span class="preprocessor">#endif</span></div></div><!-- fragment -->  </div>  <div class='newInnerHTML' title='java' style='display: none;'>Java</div><div class='toggleable_div label_java' style='display: none;'><p> This tutorial code's is shown lines below. You can also download it from <a href="https://github.com/opencv/opencv/tree/master/samples/java/tutorial_code/features2D/feature_homography/SURFFLANNMatchingHomographyDemo.java">here</a> </p><div class="fragment"><div class="line"><span class="keyword">import</span> java.util.ArrayList;</div><div class="line"><span class="keyword">import</span> java.util.List;</div><div class="line"></div><div class="line"><span class="keyword">import</span> org.opencv.calib3d.Calib3d;</div><div class="line"><span class="keyword">import</span> org.opencv.core.Core;</div><div class="line"><span class="keyword">import</span> org.opencv.core.CvType;</div><div class="line"><span class="keyword">import</span> org.opencv.core.DMatch;</div><div class="line"><span class="keyword">import</span> org.opencv.core.KeyPoint;</div><div class="line"><span class="keyword">import</span> org.opencv.core.Mat;</div><div class="line"><span class="keyword">import</span> org.opencv.core.MatOfByte;</div><div class="line"><span class="keyword">import</span> org.opencv.core.MatOfDMatch;</div><div class="line"><span class="keyword">import</span> org.opencv.core.MatOfKeyPoint;</div><div class="line"><span class="keyword">import</span> org.opencv.core.MatOfPoint2f;</div><div class="line"><span class="keyword">import</span> org.opencv.core.Point;</div><div class="line"><span class="keyword">import</span> org.opencv.core.Scalar;</div><div class="line"><span class="keyword">import</span> org.opencv.features2d.DescriptorMatcher;</div><div class="line"><span class="keyword">import</span> org.opencv.features2d.Features2d;</div><div class="line"><span class="keyword">import</span> org.opencv.highgui.HighGui;</div><div class="line"><span class="keyword">import</span> org.opencv.imgcodecs.Imgcodecs;</div><div class="line"><span class="keyword">import</span> org.opencv.imgproc.Imgproc;</div><div class="line"><span class="keyword">import</span> org.opencv.xfeatures2d.SURF;</div><div class="line"></div><div class="line"><span class="keyword">class </span>SURFFLANNMatchingHomography {</div><div class="line">    <span class="keyword">public</span> <span class="keywordtype">void</span> run(<a class="code" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a>[] args) {</div><div class="line">        <a class="code" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> filenameObject = args.length &gt; 1 ? args[0] : <span class="stringliteral">&quot;../data/box.png&quot;</span>;</div><div class="line">        <a class="code" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> filenameScene = args.length &gt; 1 ? args[1] : <span class="stringliteral">&quot;../data/box_in_scene.png&quot;</span>;</div><div class="line">        Mat imgObject = Imgcodecs.imread(filenameObject, Imgcodecs.IMREAD_GRAYSCALE);</div><div class="line">        Mat imgScene = Imgcodecs.imread(filenameScene, Imgcodecs.IMREAD_GRAYSCALE);</div><div class="line">        <span class="keywordflow">if</span> (imgObject.empty() || imgScene.empty()) {</div><div class="line">            System.err.println(<span class="stringliteral">&quot;Cannot read images!&quot;</span>);</div><div class="line">            System.exit(0);</div><div class="line">        }</div><div class="line"></div><div class="line">        <span class="comment">//-- Step 1: Detect the keypoints using SURF Detector, compute the descriptors</span></div><div class="line">        <span class="keywordtype">double</span> hessianThreshold = 400;</div><div class="line">        <span class="keywordtype">int</span> nOctaves = 4, nOctaveLayers = 3;</div><div class="line">        <span class="keywordtype">boolean</span> extended = <span class="keyword">false</span>, upright = <span class="keyword">false</span>;</div><div class="line">        SURF detector = SURF.create(hessianThreshold, nOctaves, nOctaveLayers, extended, upright);</div><div class="line">        MatOfKeyPoint keypointsObject = <span class="keyword">new</span> MatOfKeyPoint(), keypointsScene = <span class="keyword">new</span> MatOfKeyPoint();</div><div class="line">        Mat descriptorsObject = <span class="keyword">new</span> Mat(), descriptorsScene = <span class="keyword">new</span> Mat();</div><div class="line">        detector.detectAndCompute(imgObject, <span class="keyword">new</span> Mat(), keypointsObject, descriptorsObject);</div><div class="line">        detector.detectAndCompute(imgScene, <span class="keyword">new</span> Mat(), keypointsScene, descriptorsScene);</div><div class="line"></div><div class="line">        <span class="comment">//-- Step 2: Matching descriptor vectors with a FLANN based matcher</span></div><div class="line">        <span class="comment">// Since SURF is a floating-point descriptor NORM_L2 is used</span></div><div class="line">        DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.FLANNBASED);</div><div class="line">        List&lt;MatOfDMatch&gt; knnMatches = <span class="keyword">new</span> ArrayList&lt;&gt;();</div><div class="line">        matcher.knnMatch(descriptorsObject, descriptorsScene, knnMatches, 2);</div><div class="line"></div><div class="line">        <span class="comment">//-- Filter matches using the Lowe&#39;s ratio test</span></div><div class="line">        <span class="keywordtype">float</span> ratioThresh = 0.75f;</div><div class="line">        List&lt;DMatch&gt; listOfGoodMatches = <span class="keyword">new</span> ArrayList&lt;&gt;();</div><div class="line">        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; knnMatches.size(); i++) {</div><div class="line">            <span class="keywordflow">if</span> (knnMatches.get(i).rows() &gt; 1) {</div><div class="line">                DMatch[] matches = knnMatches.get(i).toArray();</div><div class="line">                <span class="keywordflow">if</span> (matches[0].distance &lt; ratioThresh * matches[1].distance) {</div><div class="line">                    listOfGoodMatches.add(matches[0]);</div><div class="line">                }</div><div class="line">            }</div><div class="line">        }</div><div class="line">        MatOfDMatch goodMatches = <span class="keyword">new</span> MatOfDMatch();</div><div class="line">        goodMatches.fromList(listOfGoodMatches);</div><div class="line"></div><div class="line">        <span class="comment">//-- Draw matches</span></div><div class="line">        Mat imgMatches = <span class="keyword">new</span> Mat();</div><div class="line">        Features2d.drawMatches(imgObject, keypointsObject, imgScene, keypointsScene, goodMatches, imgMatches, <a class="code" href="../../dc/d84/group__core__basic.html#ga599fe92e910c027be274233eccad7beb">Scalar</a>.<a class="code" href="../../d1/da0/classcv_1_1Scalar__.html#ac1509a4b8454fe7fe29db069e13a2e6f">all</a>(-1),</div><div class="line">                <a class="code" href="../../dc/d84/group__core__basic.html#ga599fe92e910c027be274233eccad7beb">Scalar</a>.<a class="code" href="../../d1/da0/classcv_1_1Scalar__.html#ac1509a4b8454fe7fe29db069e13a2e6f">all</a>(-1), <span class="keyword">new</span> MatOfByte(), Features2d.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS);</div><div class="line"></div><div class="line">        <span class="comment">//-- Localize the object</span></div><div class="line">        List&lt;Point&gt; obj = <span class="keyword">new</span> ArrayList&lt;&gt;();</div><div class="line">        List&lt;Point&gt; scene = <span class="keyword">new</span> ArrayList&lt;&gt;();</div><div class="line"></div><div class="line">        List&lt;KeyPoint&gt; listOfKeypointsObject = keypointsObject.toList();</div><div class="line">        List&lt;KeyPoint&gt; listOfKeypointsScene = keypointsScene.toList();</div><div class="line">        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; listOfGoodMatches.size(); i++) {</div><div class="line">            <span class="comment">//-- Get the keypoints from the good matches</span></div><div class="line">            obj.add(listOfKeypointsObject.get(listOfGoodMatches.get(i).queryIdx).pt);</div><div class="line">            scene.add(listOfKeypointsScene.get(listOfGoodMatches.get(i).trainIdx).pt);</div><div class="line">        }</div><div class="line"></div><div class="line">        MatOfPoint2f objMat = <span class="keyword">new</span> MatOfPoint2f(), sceneMat = <span class="keyword">new</span> MatOfPoint2f();</div><div class="line">        objMat.fromList(obj);</div><div class="line">        sceneMat.fromList(scene);</div><div class="line">        <span class="keywordtype">double</span> ransacReprojThreshold = 3.0;</div><div class="line">        Mat H = Calib3d.findHomography( objMat, sceneMat, Calib3d.RANSAC, ransacReprojThreshold );</div><div class="line"></div><div class="line">        <span class="comment">//-- Get the corners from the image_1 ( the object to be &quot;detected&quot; )</span></div><div class="line">        Mat objCorners = <span class="keyword">new</span> Mat(4, 1, CvType.CV_32FC2), sceneCorners = <span class="keyword">new</span> Mat();</div><div class="line">        <span class="keywordtype">float</span>[] objCornersData = <span class="keyword">new</span> <span class="keywordtype">float</span>[(int) (objCorners.total() * objCorners.channels())];</div><div class="line">        objCorners.get(0, 0, objCornersData);</div><div class="line">        objCornersData[0] = 0;</div><div class="line">        objCornersData[1] = 0;</div><div class="line">        objCornersData[2] = imgObject.cols();</div><div class="line">        objCornersData[3] = 0;</div><div class="line">        objCornersData[4] = imgObject.cols();</div><div class="line">        objCornersData[5] = imgObject.rows();</div><div class="line">        objCornersData[6] = 0;</div><div class="line">        objCornersData[7] = imgObject.rows();</div><div class="line">        objCorners.put(0, 0, objCornersData);</div><div class="line"></div><div class="line">        Core.perspectiveTransform(objCorners, sceneCorners, H);</div><div class="line">        <span class="keywordtype">float</span>[] sceneCornersData = <span class="keyword">new</span> <span class="keywordtype">float</span>[(int) (sceneCorners.total() * sceneCorners.channels())];</div><div class="line">        sceneCorners.get(0, 0, sceneCornersData);</div><div class="line"></div><div class="line">        <span class="comment">//-- Draw lines between the corners (the mapped object in the scene - image_2 )</span></div><div class="line">        Imgproc.line(imgMatches, <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga1e83eafb2d26b3c93f09e8338bcab192">Point</a>(sceneCornersData[0] + imgObject.cols(), sceneCornersData[1]),</div><div class="line">                <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga1e83eafb2d26b3c93f09e8338bcab192">Point</a>(sceneCornersData[2] + imgObject.cols(), sceneCornersData[3]), <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga599fe92e910c027be274233eccad7beb">Scalar</a>(0, 255, 0), 4);</div><div class="line">        Imgproc.line(imgMatches, <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga1e83eafb2d26b3c93f09e8338bcab192">Point</a>(sceneCornersData[2] + imgObject.cols(), sceneCornersData[3]),</div><div class="line">                <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga1e83eafb2d26b3c93f09e8338bcab192">Point</a>(sceneCornersData[4] + imgObject.cols(), sceneCornersData[5]), <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga599fe92e910c027be274233eccad7beb">Scalar</a>(0, 255, 0), 4);</div><div class="line">        Imgproc.line(imgMatches, <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga1e83eafb2d26b3c93f09e8338bcab192">Point</a>(sceneCornersData[4] + imgObject.cols(), sceneCornersData[5]),</div><div class="line">                <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga1e83eafb2d26b3c93f09e8338bcab192">Point</a>(sceneCornersData[6] + imgObject.cols(), sceneCornersData[7]), <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga599fe92e910c027be274233eccad7beb">Scalar</a>(0, 255, 0), 4);</div><div class="line">        Imgproc.line(imgMatches, <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga1e83eafb2d26b3c93f09e8338bcab192">Point</a>(sceneCornersData[6] + imgObject.cols(), sceneCornersData[7]),</div><div class="line">                <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga1e83eafb2d26b3c93f09e8338bcab192">Point</a>(sceneCornersData[0] + imgObject.cols(), sceneCornersData[1]), <span class="keyword">new</span> <a class="code" href="../../dc/d84/group__core__basic.html#ga599fe92e910c027be274233eccad7beb">Scalar</a>(0, 255, 0), 4);</div><div class="line"></div><div class="line">        <span class="comment">//-- Show detected matches</span></div><div class="line">        HighGui.imshow(<span class="stringliteral">&quot;Good Matches &amp; Object detection&quot;</span>, imgMatches);</div><div class="line">        HighGui.waitKey(0);</div><div class="line"></div><div class="line">        System.exit(0);</div><div class="line">    }</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">public</span> <span class="keyword">class </span>SURFFLANNMatchingHomographyDemo {</div><div class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">void</span> main(<a class="code" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a>[] args) {</div><div class="line">        <span class="comment">// Load the native OpenCV library</span></div><div class="line">        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);</div><div class="line"></div><div class="line">        <span class="keyword">new</span> SURFFLANNMatchingHomography().run(args);</div><div class="line">    }</div><div class="line">}</div></div><!-- fragment -->  </div>  <div class='newInnerHTML' title='python' style='display: none;'>Python</div><div class='toggleable_div label_python' style='display: none;'><p> This tutorial code's is shown lines below. You can also download it from <a href="https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.py">here</a> </p><div class="fragment"><div class="line"><span class="keyword">from</span> __future__ <span class="keyword">import</span> print_function</div><div class="line"><span class="keyword">import</span> cv2 <span class="keyword">as</span> cv</div><div class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div><div class="line"><span class="keyword">import</span> argparse</div><div class="line"></div><div class="line">parser = argparse.ArgumentParser(description=<span class="stringliteral">&#39;Code for Feature Matching with FLANN tutorial.&#39;</span>)</div><div class="line">parser.add_argument(<span class="stringliteral">&#39;--input1&#39;</span>, help=<span class="stringliteral">&#39;Path to input image 1.&#39;</span>, default=<span class="stringliteral">&#39;box.png&#39;</span>)</div><div class="line">parser.add_argument(<span class="stringliteral">&#39;--input2&#39;</span>, help=<span class="stringliteral">&#39;Path to input image 2.&#39;</span>, default=<span class="stringliteral">&#39;box_in_scene.png&#39;</span>)</div><div class="line">args = parser.parse_args()</div><div class="line"></div><div class="line">img_object = <a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">cv.imread</a>(<a class="code" href="../../d6/dba/group__core__utils__samples.html#ga3a33b00033b46c698ff6340d95569c13">cv.samples.findFile</a>(args.input1), cv.IMREAD_GRAYSCALE)</div><div class="line">img_scene = <a class="code" href="../../d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56">cv.imread</a>(<a class="code" href="../../d6/dba/group__core__utils__samples.html#ga3a33b00033b46c698ff6340d95569c13">cv.samples.findFile</a>(args.input2), cv.IMREAD_GRAYSCALE)</div><div class="line"><span class="keywordflow">if</span> img_object <span class="keywordflow">is</span> <span class="keywordtype">None</span> <span class="keywordflow">or</span> img_scene <span class="keywordflow">is</span> <span class="keywordtype">None</span>:</div><div class="line">    <a class="code" href="../../df/d57/namespacecv_1_1dnn.html#a701210a0203f2786cbfd04b2bd56da47">print</a>(<span class="stringliteral">&#39;Could not open or find the images!&#39;</span>)</div><div class="line">    exit(0)</div><div class="line"></div><div class="line"><span class="comment">#-- Step 1: Detect the keypoints using SURF Detector, compute the descriptors</span></div><div class="line">minHessian = 400</div><div class="line">detector = cv.xfeatures2d_SURF.create(hessianThreshold=minHessian)</div><div class="line">keypoints_obj, descriptors_obj = detector.detectAndCompute(img_object, <span class="keywordtype">None</span>)</div><div class="line">keypoints_scene, descriptors_scene = detector.detectAndCompute(img_scene, <span class="keywordtype">None</span>)</div><div class="line"></div><div class="line"><span class="comment">#-- Step 2: Matching descriptor vectors with a FLANN based matcher</span></div><div class="line"><span class="comment"># Since SURF is a floating-point descriptor NORM_L2 is used</span></div><div class="line">matcher = cv.DescriptorMatcher_create(cv.DescriptorMatcher_FLANNBASED)</div><div class="line">knn_matches = matcher.knnMatch(descriptors_obj, descriptors_scene, 2)</div><div class="line"></div><div class="line"><span class="comment">#-- Filter matches using the Lowe&#39;s ratio test</span></div><div class="line">ratio_thresh = 0.75</div><div class="line">good_matches = []</div><div class="line"><span class="keywordflow">for</span> m,n <span class="keywordflow">in</span> knn_matches:</div><div class="line">    <span class="keywordflow">if</span> m.distance &lt; ratio_thresh * n.distance:</div><div class="line">        good_matches.append(m)</div><div class="line"></div><div class="line"><span class="comment">#-- Draw matches</span></div><div class="line">img_matches = np.empty((<a class="code" href="../../d1/d10/classcv_1_1MatExpr.html#a6dff8b6e9105b6d817b493e7be157c90">max</a>(img_object.shape[0], img_scene.shape[0]), img_object.shape[1]+img_scene.shape[1], 3), dtype=np.uint8)</div><div class="line"><a class="code" href="../../d4/d5d/group__features2d__draw.html#ga62fbedb5206ab2faf411797e7055c90f">cv.drawMatches</a>(img_object, keypoints_obj, img_scene, keypoints_scene, good_matches, img_matches, flags=cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)</div><div class="line"></div><div class="line"><span class="comment">#-- Localize the object</span></div><div class="line">obj = np.empty((len(good_matches),2), dtype=np.float32)</div><div class="line">scene = np.empty((len(good_matches),2), dtype=np.float32)</div><div class="line"><span class="keywordflow">for</span> i <span class="keywordflow">in</span> range(len(good_matches)):</div><div class="line">    <span class="comment">#-- Get the keypoints from the good matches</span></div><div class="line">    obj[i,0] = keypoints_obj[good_matches[i].queryIdx].pt[0]</div><div class="line">    obj[i,1] = keypoints_obj[good_matches[i].queryIdx].pt[1]</div><div class="line">    scene[i,0] = keypoints_scene[good_matches[i].trainIdx].pt[0]</div><div class="line">    scene[i,1] = keypoints_scene[good_matches[i].trainIdx].pt[1]</div><div class="line"></div><div class="line">H, _ =  <a class="code" href="../../d9/d0c/group__calib3d.html#ga4b3841447530523e5272ec05c5d1e411">cv.findHomography</a>(obj, scene, cv.RANSAC)</div><div class="line"></div><div class="line"><span class="comment">#-- Get the corners from the image_1 ( the object to be &quot;detected&quot; )</span></div><div class="line">obj_corners = np.empty((4,1,2), dtype=np.float32)</div><div class="line">obj_corners[0,0,0] = 0</div><div class="line">obj_corners[0,0,1] = 0</div><div class="line">obj_corners[1,0,0] = img_object.shape[1]</div><div class="line">obj_corners[1,0,1] = 0</div><div class="line">obj_corners[2,0,0] = img_object.shape[1]</div><div class="line">obj_corners[2,0,1] = img_object.shape[0]</div><div class="line">obj_corners[3,0,0] = 0</div><div class="line">obj_corners[3,0,1] = img_object.shape[0]</div><div class="line"></div><div class="line">scene_corners = <a class="code" href="../../d2/de8/group__core__array.html#gad327659ac03e5fd6894b90025e6900a7">cv.perspectiveTransform</a>(obj_corners, H)</div><div class="line"></div><div class="line"><span class="comment">#-- Draw lines between the corners (the mapped object in the scene - image_2 )</span></div><div class="line"><a class="code" href="../../d6/d6e/group__imgproc__draw.html#ga7078a9fae8c7e7d13d24dac2520ae4a2">cv.line</a>(img_matches, (int(scene_corners[0,0,0] + img_object.shape[1]), int(scene_corners[0,0,1])),\</div><div class="line">    (int(scene_corners[1,0,0] + img_object.shape[1]), int(scene_corners[1,0,1])), (0,255,0), 4)</div><div class="line"><a class="code" href="../../d6/d6e/group__imgproc__draw.html#ga7078a9fae8c7e7d13d24dac2520ae4a2">cv.line</a>(img_matches, (int(scene_corners[1,0,0] + img_object.shape[1]), int(scene_corners[1,0,1])),\</div><div class="line">    (int(scene_corners[2,0,0] + img_object.shape[1]), int(scene_corners[2,0,1])), (0,255,0), 4)</div><div class="line"><a class="code" href="../../d6/d6e/group__imgproc__draw.html#ga7078a9fae8c7e7d13d24dac2520ae4a2">cv.line</a>(img_matches, (int(scene_corners[2,0,0] + img_object.shape[1]), int(scene_corners[2,0,1])),\</div><div class="line">    (int(scene_corners[3,0,0] + img_object.shape[1]), int(scene_corners[3,0,1])), (0,255,0), 4)</div><div class="line"><a class="code" href="../../d6/d6e/group__imgproc__draw.html#ga7078a9fae8c7e7d13d24dac2520ae4a2">cv.line</a>(img_matches, (int(scene_corners[3,0,0] + img_object.shape[1]), int(scene_corners[3,0,1])),\</div><div class="line">    (int(scene_corners[0,0,0] + img_object.shape[1]), int(scene_corners[0,0,1])), (0,255,0), 4)</div><div class="line"></div><div class="line"><span class="comment">#-- Show detected matches</span></div><div class="line"><a class="code" href="../../df/d24/group__highgui__opengl.html#gaae7e90aa3415c68dba22a5ff2cefc25d">cv.imshow</a>(<span class="stringliteral">&#39;Good Matches &amp; Object detection&#39;</span>, img_matches)</div><div class="line"></div><div class="line"><a class="code" href="../../d7/dfc/group__highgui.html#ga5628525ad33f52eab17feebcfba38bd7">cv.waitKey</a>()</div></div><!-- fragment -->  </div> <h2>Explanation </h2>
<h2>Result </h2>
<ul>
<li><p class="startli">And here is the result for the detected object (highlighted in green). Note that since the homography is estimated with a RANSAC approach, detected false matches will not impact the homography calculation.</p>
<div class="image">
<img src="../../Feature_Homography_Result.jpg" alt="Feature_Homography_Result.jpg"/>
</div>
 </li>
</ul>
</div></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Apr 2 2021 11:36:34 for OpenCV by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
<script type="text/javascript">
//<![CDATA[
addTutorialsButtons();
//]]>
</script>
</body>
</html>
